package com.online.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.online.entity.Score;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

import java.util.List;

@Mapper
public interface ScoreMapper {
    /**
     * 查询所有学生成绩
     * @return
     */
    List<Score> findAll();

    /**
     * 根据ID查询成绩
     * @param scorePage
     * @param studentId
     * @return
     */
    IPage<Score> findById(Page<Score> scorePage, Integer studentId);

    /**
     * 添加学生成绩
     * @param score
     * @return
     */
    @Options(useGeneratedKeys = true,keyProperty = "scoreId")
    int add(Score score);

    /**
     * 查询每位学生的学科分数
     * @param examCode
     * @return
     */
    List<Score> findByExamCode(Integer examCode);
}
